<?php
$name1=$_REQUEST['username'];
$password= md5($_REQUEST['password']);
define('HOST', 'localhost');
define('USER', 'mes');
define('PASSWORD', '111111');
define('DATABASE', 'mes');
$conn = mysqli_connect(HOST, USER, PASSWORD, DATABASE)or die('数据库连接失败' . mysqli_connect_error());
$sql = "select * from user_info where name='$name1' and password='$password'";
$res = mysqli_query($conn, $sql);

if(mysqli_num_rows($res)===1){
//    setcookie('name',$name1, 0,'/');
    session_start();
    $_SESSION['name']=$name1;
//    var_dump($_SESSION['name']);
    echo '<script>alert("登录成功");window.location="liuyan0.php";</script>';
}else{
    echo '<script>alert("登录失败");window.location="denglu.html";</script>';
}
//
//